﻿using System;
using System.Collections.Generic;
using System.Text;

namespace WordService.Model
{
    /// <summary>
    /// 关键字模型
    /// </summary>
    public sealed class Keyword
    {
        private Int64 _ID;
        /// <summary>
        /// 关键字的ID号
        /// </summary>
        public Int64 ID
        {
            get { return _ID; }
            set { _ID = value; }
        }
        private String _Name;
        /// <summary>
        /// 关键字的名称
        /// </summary>
        public String Name
        {
            get { return _Name; }
            set { _Name = value; }
        }
        private Int64 _Count;
        /// <summary>
        /// 某一篇文章出现的次数
        /// </summary>
        public Int64 Count
        {
            get { return _Count; }
            set { _Count = value; }
        }

        private double _RightRate;
        /// <summary>
        /// 关键字的权值
        /// </summary>
        public double RightRate
        {
            get { return _RightRate; }
            set { _RightRate = value; }
        }

        private Article _Article;
        /// <summary>
        /// 关键字出现的文章
        /// </summary>
        public Article Article
        {
            get { return _Article; }
            set { _Article = value; }
        }
        
        private Int64 _TotalCount;
        /// <summary>
        /// 目前累积下来关键字的总出现次数
        /// </summary>
        public Int64 TotalCount
        {
            get { return _TotalCount; }
            set { _TotalCount = value; }
        }

        public override bool Equals(object obj)
        {
            if (obj == null) return false;
            if (object.ReferenceEquals(this, obj)) return true;
            if (this.GetType() != obj.GetType()) return false;
            return CompareKeyword(obj as Keyword);
        }

        private bool CompareKeyword(Keyword keyword)
        {
            return _ID.Equals(keyword.ID);
        }
    }
}
